function A() {

    return new Promise(function(resolve,reject){

        setTimeout(()=>{
            console.log('同步')
            resolve
        },1000)
    })
}

function B(){

    console.log('同步b')
}



function* gen() {

    yield A()
    yield B()
}

let g = gen() 
  
g.next().value.then(() => {        // g.next().value得到一个promise 对象，promise 对象.then()等
     
    g.next().value.then(()=>{
        g.next()
    })
})